package Classes.GameUtils// ActionScript file
{
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;

	public class GU_GetTargetChildByName
	{
		public static function getTargetChildByName(fatherContainer:DisplayObjectContainer,targetName:String):DisplayObject
		{
			if(fatherContainer.name==targetName)return fatherContainer;
			for(var i:int=0;i<fatherContainer.numChildren;i++)
			{
				var checkDisplayer:DisplayObject=fatherContainer.getChildAt(i);
				if(checkDisplayer is DisplayObjectContainer)
				{
					var returnDisplayer:DisplayObject=getTargetChildByName(checkDisplayer as DisplayObjectContainer,targetName);
					if(returnDisplayer)return returnDisplayer;
				}
				else if(checkDisplayer.name==targetName)
				{
					return checkDisplayer;
				}
			}
			return null;
		}
	}
}